/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package batailledesardennes.game.entity.collision;

import batailledesardennes.game.entity.Entity;
import batailledesardennes.util.geomFloat.Shape;
import batailledesardennes.util.geomFloat.path.NodeHandler;
import batailledesardennes.util.geomFloat.path.Obstacle;

/**
 *
 * @author cghislai
 */
public class EntityCollsionManager {

    private Obstacle obstacle;
    private Shape bounds;
    private Entity entity;

    public void setBounds(Shape bounds) {
        this.bounds = bounds;
    }

    public void setEntity(Entity entity) {
        this.entity = entity;
    }

    public Shape getBounds() {
        return bounds;
    }

    public void register() {
        bounds.translateTo(entity.getPos());
        obstacle = new Obstacle(bounds);
        NodeHandler nodeHandler = entity.getEnv().getMap().getAccessHandler().getNodeHandler();
        nodeHandler.addObstacle(obstacle);
    }

    public void unregsiter() {
        NodeHandler nodeHandler = entity.getEnv().getMap().getAccessHandler().getNodeHandler();
        nodeHandler.removeObstacle(obstacle);
    }
}
